﻿<UserControl x:Class="Agility.Controls.MyIdeas"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="clr-namespace:Agility.ViewModels;assembly=Agility.ViewModels"
    xmlns:mdl="clr-namespace:Agility.Web.Models.DomainModel;assembly=Agility.ViewModels"
    mc:Ignorable="d"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
    xmlns:tlkt="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    Name="userControlMyIdeas" Visibility="{Binding Path=MyIdeasVisibility}" d:DesignHeight="0" d:DesignWidth="0">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel>
            <TextBlock Text="My Ideas" Style="{StaticResource SubheaderTextStyle}" Margin="6,6,6,0" />
            <sdk:DataGrid Name="dataGridMyIdeas" AutoGenerateColumns="True" Height="Auto" Width="Auto" Margin="6,3,6,0" 
                          HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"
                          ItemsSource="{Binding Path=MyEpics, Mode=OneWay}" d:DataContext="{d:DesignInstance Type=mdl:Epic}"
                          AutoGeneratingColumn="dataGridMyIdeas_AutoGeneratingColumn" SelectionChanged="dataGridMyIdeas_SelectionChanged" />
            
            <sdk:DataPager x:Name="pagerMyIdeas" PageSize="5" AutoEllipsis="True" DisplayMode="FirstLastPreviousNextNumeric"
                           Source="{Binding Path=MyEpics}" Margin="6,0,6,3" />

            <tlkt:DataForm x:Name="dataFormIdea" Style="{StaticResource TemplatedDataFormStyle}" 
                           CommandButtonsVisibility="Add, Edit, Commit, Cancel" MaxWidth="800"
                           ItemsSource="{Binding Path=MyEpics, Mode=OneWay}" d:DataContext="{d:DesignInstance Type=mdl:Epic}"
                           EditEnded="dataFormIdea_EditEnded" ContentLoaded="dataFormIdea_ContentLoaded" >
                <tlkt:DataForm.NewItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <tlkt:DataField Grid.Column="0" Grid.Row="0">
                                <TextBox x:Name="textBoxCreationDate" IsReadOnly="True"
                                         Text="{Binding Path=CreationDate, Mode=TwoWay}" />
                            </tlkt:DataField>
                            <tlkt:DataField Grid.Column="1" Grid.Row="0">
                                <TextBox x:Name="textBoxRequestedBy" IsReadOnly="True"
                                         Text="{Binding Path=RequestedBy, Mode=TwoWay}" />
                            </tlkt:DataField>
                            <tlkt:DataField Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1">
                                <TextBox x:Name="textBoxTitle"
                                         Text="{Binding Path=Title, Mode=TwoWay}" />
                            </tlkt:DataField>
                            <tlkt:DataField Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2">
                                <TextBox x:Name="textBoxDescription"
                                         MinHeight="69" AcceptsReturn="True" TextWrapping="Wrap"
                                         Text="{Binding Path=Description, Mode=TwoWay}" />
                            </tlkt:DataField>
                        </Grid>
                    </DataTemplate>
                </tlkt:DataForm.NewItemTemplate>
                <tlkt:DataForm.EditTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <tlkt:DataField Grid.Column="0" Grid.Row="0">
                                <TextBox x:Name="textBoxCreationDate" IsReadOnly="True"
                                         Text="{Binding Path=CreationDate, Mode=TwoWay}" />
                            </tlkt:DataField>
                            <tlkt:DataField Grid.Column="1" Grid.Row="0">
                                <TextBox x:Name="textBoxRequestedBy" IsReadOnly="True"
                                         Text="{Binding Path=RequestedBy, Mode=TwoWay}" />
                            </tlkt:DataField>
                            <tlkt:DataField Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1">
                                <TextBox x:Name="textBoxTitle"
                                         Text="{Binding Path=Title, Mode=TwoWay}" />
                            </tlkt:DataField>
                            <tlkt:DataField Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2">
                                <TextBox x:Name="textBoxDescription"
                                         MinHeight="69" AcceptsReturn="True" TextWrapping="Wrap"
                                         Text="{Binding Path=Description, Mode=TwoWay}" />
                            </tlkt:DataField>
                        </Grid>
                    </DataTemplate>
                </tlkt:DataForm.EditTemplate>
            </tlkt:DataForm>
        </StackPanel>
    </Grid>
</UserControl>
